package com.example.multithreading;

public class ch02_05 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread =new Thread(()->{
            while(true){
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        thread.setDaemon(true); //设置为守护线程
        thread.start();
        Thread.sleep(2_00L);

        System.out.println("主线程停止生命周期");
    }
}
